<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/dute_favicon_32x32.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/dute_favicon_16x16.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">
  <link rel="manifest" href="/images/manifest.json">
  <meta name="msapplication-config" content="/images/browserconfig.xml">
  <meta http-equiv="Cache-Control" content="no-transform">
  <meta http-equiv="Cache-Control" content="no-siteapp">
  <meta name="google-site-verification" content="mpI5dkydstZXl6UcDCppqktXK0bbvqdZ6LkZ3KNk4Iw">
  <meta name="baidu-site-verification" content="code-a1LksZX2Ds">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">
  <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"whitestore.top","root":"/","scheme":"Gemini","version":"7.8.0","exturl":true,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":true,"scrollpercent":true},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":true,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="百度编辑器的一些踩坑以及我是如何看待和解决问题的">
<meta property="og:type" content="article">
<meta property="og:title" content="百度编辑器的那些坑">
<meta property="og:url" content="https://whitestore.top/2020/10/11/note32/index.html">
<meta property="og:site_name" content="爱看书的阿东">
<meta property="og:description" content="百度编辑器的一些踩坑以及我是如何看待和解决问题的">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20201011120300.png">
<meta property="og:image" content="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20201011124205.png">
<meta property="og:image" content="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20201011132122.png">
<meta property="og:image" content="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20201011132536.png">
<meta property="og:image" content="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20201011133204.png">
<meta property="og:image" content="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20201011125214.png">
<meta property="article:published_time" content="2020-10-11T06:28:18.000Z">
<meta property="article:modified_time" content="2023-07-16T06:28:09.273Z">
<meta property="article:author" content="阿东">
<meta property="article:tag" content="百度编辑器">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20201011120300.png">

<link rel="canonical" href="https://whitestore.top/2020/10/11/note32/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>百度编辑器的那些坑 | 爱看书的阿东</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

<link rel="alternate" href="/atom.xml" title="爱看书的阿东" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">爱看书的阿东</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">赐他一块白色石头，石头上写着新名</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
        <li class="menu-item menu-item-sitemap">

    <a href="/sitemap.xml" rel="section"><i class="fa fa-fw fa-sitemap"></i>站点地图</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    

  <span class="exturl github-corner" data-url="aHR0cHM6Ly9naXRodWIuY29tL2xhenlUaW1lcw==" title="Follow me on GitHub" aria-label="Follow me on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></span>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://whitestore.top/2020/10/11/note32/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="阿东">
      <meta itemprop="description" content="随遇而安">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="爱看书的阿东">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          百度编辑器的那些坑
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2020-10-11 14:28:18" itemprop="dateCreated datePublished" datetime="2020-10-11T14:28:18+08:00">2020-10-11</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2023-07-16 14:28:09" itemprop="dateModified" datetime="2023-07-16T14:28:09+08:00">2023-07-16</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/frontend/" itemprop="url" rel="index"><span itemprop="name">前端</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span>
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="fa fa-comment-o"></i>
      </span>
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/2020/10/11/note32/#valine-comments" itemprop="discussionUrl">
      <span class="post-comments-count valine-comment-count" data-xid="/2020/10/11/note32/" itemprop="commentCount"></span>
    </a>
  </span>
  
  <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="fa fa-file-word-o"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>8.3k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="fa fa-clock-o"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>8 分钟</span>
            </span>
            <div class="post-description">百度编辑器的一些踩坑以及我是如何看待和解决问题的</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="百度编辑器的那些坑："><a href="#百度编辑器的那些坑：" class="headerlink" title="百度编辑器的那些坑："></a>百度编辑器的那些坑：</h1><h2 id="前言："><a href="#前言：" class="headerlink" title="前言："></a>前言：</h2><p>最近在处理公司的旧后台浏览器兼容问题，要求更换<code>ewebeditor</code> 编辑器，更换为ueditor 编辑器，并且要求 IE9/IE8/IE10/IE11/Micro Edge/Google/360 编辑器各项兼容，听说百度的编辑器兼容至IE6，以为简单的换个编辑器的我，在上面折腾了不少时间，本文针对具体问题进行处理，可能读者遇不到我这样的问题，事前说明：<strong>仅供参考</strong>、<strong>仅供参考</strong>、<strong>仅供参考</strong></p>
<a id="more"></a>

<h2 id="问题："><a href="#问题：" class="headerlink" title="问题："></a>问题：</h2><ol>
<li>百度编辑器粘贴图片的时候，会出现暴露内网IP的隐患  - IE问题</li>
<li>百度编辑器<code>Ctril + v</code>粘贴图片功能在IE上面不触发任何效果的问题</li>
<li>特殊符号传输后台的转义问题，以及将数据库的html读取之后，由于双引号导致的截取页面报错问题</li>
<li>针对 <code>iframe</code>这种嵌套框架，在保存的之后，拿不到编辑器内容的兼容处理方式</li>
</ol>
<h2 id="百度编辑器粘贴图片的时候，会出现暴露内网IP的隐患-IE问题"><a href="#百度编辑器粘贴图片的时候，会出现暴露内网IP的隐患-IE问题" class="headerlink" title="百度编辑器粘贴图片的时候，会出现暴露内网IP的隐患  - IE问题"></a>百度编辑器粘贴图片的时候，会出现暴露内网IP的隐患  - IE问题</h2><h3 id="问题复现"><a href="#问题复现" class="headerlink" title="问题复现"></a>问题复现</h3><p>使用粘贴图片就会出现如下的问题，在查看源代码的时候，出现了如图所示的暴露源代码的问题，出现问题原因不明:</p>
<p><img src="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20201011120300.png" alt=""></p>
<h3 id="解决办法："><a href="#解决办法：" class="headerlink" title="解决办法："></a>解决办法：</h3><ol>
<li>非常简单，只需要关闭<code>查看源代码</code>的按钮就行，完美解决</li>
<li>如果一定要保留，在不知道如何处理的情况下，并且急需交差的时候，可以这么干（当时情况是第二天就得交差，由于一直找不到问题点，加班到晚上10想出来的办法）</li>
</ol>
<h3 id="障眼法："><a href="#障眼法：" class="headerlink" title="障眼法："></a>障眼法：</h3><p>先直接上代码：</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 点击源代码按钮对于编辑器的内容进行敏感href信息处理 2019.9.24</span></span><br><span class="line">   $(<span class="string">'body'</span>).delegate(<span class="string">".edui-button-wrap"</span>,<span class="string">"click"</span>,<span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">       <span class="keyword">var</span> editTxt = $(<span class="string">'.edui-editor-iframeholder'</span>).find(<span class="string">'textarea'</span>)</span><br><span class="line">       <span class="keyword">if</span>(editTxt.length)&#123;</span><br><span class="line">           <span class="keyword">var</span> content = UE.getEditor(<span class="string">'ueditor'</span>).getContent();</span><br><span class="line">           <span class="keyword">var</span> aE = $(<span class="string">'&lt;div&gt;&lt;/div&gt;'</span>);</span><br><span class="line">           aE.html(content)</span><br><span class="line">           <span class="comment">// alert(aE)</span></span><br><span class="line">           aE.find(<span class="string">'p.filedata'</span>).each(<span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">               <span class="keyword">var</span> newA = $(<span class="keyword">this</span>).find(<span class="string">'a'</span>)</span><br><span class="line">               <span class="comment">// alert(newA.attr('href'))</span></span><br><span class="line">               <span class="keyword">if</span>(newA.attr(<span class="string">'href'</span>).indexOf(<span class="string">"http://"</span>)&gt;=<span class="number">0</span> || newA.attr(<span class="string">'href'</span>).indexOf(<span class="string">"https://"</span>)&gt;=<span class="number">0</span>)&#123;</span><br><span class="line">                   <span class="keyword">var</span> arr = newA.attr(<span class="string">'href'</span>).split(<span class="string">'/'</span>)</span><br><span class="line">                   <span class="keyword">var</span> newTxt = <span class="string">''</span></span><br><span class="line">                   <span class="keyword">for</span>(<span class="keyword">var</span> i=<span class="number">3</span>; i&lt;arr.length;i++)&#123;</span><br><span class="line">                       newTxt +=<span class="string">'/'</span>+arr[i]</span><br><span class="line">                   &#125;</span><br><span class="line">                   newA.attr(<span class="string">'href'</span>,newTxt)</span><br><span class="line">               &#125;</span><br><span class="line"></span><br><span class="line">           &#125;)</span><br><span class="line">           <span class="comment">// alert(content);</span></span><br><span class="line">           <span class="comment">// 获取转义之后的字符</span></span><br><span class="line">           <span class="keyword">var</span> formatTxt = toTxt(aE.html());</span><br><span class="line">           <span class="comment">// formatTxt = appendBrToPAlfter(formatTxt);</span></span><br><span class="line">           editTxt.html(formatTxt);</span><br><span class="line"></span><br><span class="line">       &#125;</span><br><span class="line">   &#125;);</span><br><span class="line"></span><br><span class="line">   <span class="comment">/*正则表达式 替换括号,尖括号等*/</span></span><br><span class="line">   <span class="function"><span class="keyword">function</span> <span class="title">toTxt</span>(<span class="params">str</span>) </span>&#123;</span><br><span class="line">       <span class="keyword">var</span> RexStr = <span class="regexp">/\&lt;|\&gt;|\"|\'|\&amp;/g</span></span><br><span class="line">       str = str.replace(RexStr, <span class="function"><span class="keyword">function</span>(<span class="params">MatchStr</span>) </span>&#123;</span><br><span class="line">           <span class="keyword">switch</span> (MatchStr) &#123;</span><br><span class="line">               <span class="keyword">case</span> <span class="string">"&lt;"</span>:</span><br><span class="line">                   <span class="keyword">return</span> <span class="string">"&amp;lt;"</span>;</span><br><span class="line">                   <span class="keyword">break</span>;</span><br><span class="line">               <span class="keyword">case</span> <span class="string">"&gt;"</span>:</span><br><span class="line">                   <span class="keyword">return</span> <span class="string">"&amp;gt;"</span>;</span><br><span class="line">                   <span class="keyword">break</span>;</span><br><span class="line">               <span class="keyword">case</span> <span class="string">"\""</span>:</span><br><span class="line">                   <span class="keyword">return</span> <span class="string">"&amp;quot;"</span>;</span><br><span class="line">                   <span class="keyword">break</span>;</span><br><span class="line">               <span class="keyword">case</span> <span class="string">"'"</span>:</span><br><span class="line">                   <span class="keyword">return</span> <span class="string">"&amp;#39;"</span>;</span><br><span class="line">                   <span class="keyword">break</span>;</span><br><span class="line">               <span class="keyword">case</span> <span class="string">"&amp;"</span>:</span><br><span class="line">                   <span class="keyword">return</span> <span class="string">"&amp;amp;"</span>;</span><br><span class="line">                   <span class="keyword">break</span>;</span><br><span class="line">               <span class="keyword">default</span>:</span><br><span class="line">                   <span class="keyword">break</span>;</span><br><span class="line">           &#125;</span><br><span class="line">       &#125;)</span><br><span class="line">       <span class="keyword">return</span> str;</span><br><span class="line">   &#125;</span><br></pre></td></tr></table></figure>

<ol>
<li>绑定一个失去焦点的事件，在读取源代码的时候，对于内容进行截断</li>
<li>重新为href 赋值，保证连接无内网地址</li>
<li>去除掉内容里面的特殊标签，</li>
<li>重新为富文本框赋值</li>
</ol>
<h3 id="总结："><a href="#总结：" class="headerlink" title="总结："></a>总结：</h3><ol>
<li>比较搞笑的解决方式，但是当领导掐着你脖子的时候，解决问题永远是第一位。至少这种方式上线之后，没有反馈出现过问题，各个版本的浏览器都是兼容的，算是逃过一劫</li>
<li>个人建议富文本编辑器有空多去玩玩查看源代码的功能，有时候编辑器的默认设置可能会坑了你，比如百度编辑器默认会加上 p 标签。。。。</li>
</ol>
<h2 id="特殊符号传输后台的转义问题，以及读取数据的问题"><a href="#特殊符号传输后台的转义问题，以及读取数据的问题" class="headerlink" title="特殊符号传输后台的转义问题，以及读取数据的问题"></a>特殊符号传输后台的转义问题，以及读取数据的问题</h2><h2 id="amp"><a href="#amp" class="headerlink" title="&amp;"></a>&amp;</h2><h2 id="针对-iframe这种嵌套框架，在保存的之后，拿不到编辑器内容的兼容处理方式"><a href="#针对-iframe这种嵌套框架，在保存的之后，拿不到编辑器内容的兼容处理方式" class="headerlink" title="针对 iframe这种嵌套框架，在保存的之后，拿不到编辑器内容的兼容处理方式"></a>针对 <code>iframe</code>这种嵌套框架，在保存的之后，拿不到编辑器内容的兼容处理方式</h2><h3 id="问题复现："><a href="#问题复现：" class="headerlink" title="问题复现："></a>问题复现：</h3><p>​    由于旧后台是使用iframe进行拼接旧后台系统，在保存的时候，表单无法拿到富文本编辑框的内容，并且在读取的时候，会导致一些样式代码被截断导致内容显示不全的问题。</p>
<p>​    我们都知道富文本在数据库存储的一般都是html原文，一般的系统都会对一些 &lt; &gt; \ $ % 这种字符进行转义处理或者拦截。所以我们直接用js传原生文本肯定是不行的，需要进过如下的处理：</p>
<p>存储的时候：</p>
<ol>
<li>转移特殊符号，替换原文本</li>
<li>拦截器拦截检测是否有特殊文本，进行二次转义</li>
<li>存储之前，将转义字符变为原始 &lt; &gt; 等标签，替换内容</li>
<li>将富文本存储到数据库，完成</li>
</ol>
<p>读取的时候：</p>
<ol>
<li>读取数据库的内容</li>
<li>回显内容到富文本编辑器（这一步其实会遇到非常多的奇怪问题，请看下文）</li>
</ol>
<p>​    至于保存的时候，这里的实际情况是，旧版本的ewebeditor，在父iframe也就是表单的父页面使用了一个<code>textarea</code> 标签来保存具体的内容，导致即使我在<code>iframe</code>操作之后，依然会出现问题。</p>
<p><img src="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20201011124205.png" alt=""></p>
<h3 id="解决办法：-1"><a href="#解决办法：-1" class="headerlink" title="解决办法："></a>解决办法：</h3><p>也是直接上代码：</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> ue = UE.getEditor(<span class="string">'ueditor'</span>);</span><br><span class="line"></span><br><span class="line">  <span class="comment">//初始化内容</span></span><br><span class="line">  <span class="built_in">window</span>.onload = <span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">      setTimeout(<span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">          ue.setContent($(<span class="string">'#'</span>+QueryStringByName(<span class="string">'id'</span>), parent.document).val())</span><br><span class="line">      &#125;,<span class="number">500</span>)</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="comment">// 绑定失去焦点事件</span></span><br><span class="line">  ue.addListener(<span class="string">'blur'</span>,<span class="function"><span class="keyword">function</span>(<span class="params">editor</span>)</span>&#123;</span><br><span class="line">      <span class="keyword">var</span> content = UE.getEditor(<span class="string">'ueditor'</span>).getContent();</span><br><span class="line">      <span class="keyword">var</span> aE = $(<span class="string">'&lt;div&gt;&lt;/div&gt;'</span>);</span><br><span class="line"></span><br><span class="line">      aE.html(content)</span><br><span class="line">      aE.find(<span class="string">'p.filedata'</span>).each(<span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">          <span class="keyword">var</span> newA = $(<span class="keyword">this</span>).find(<span class="string">'a'</span>)</span><br><span class="line">          <span class="keyword">if</span>(newA.attr(<span class="string">'href'</span>).indexOf(<span class="string">"http://"</span>)&gt;=<span class="number">0</span> || newA.attr(<span class="string">'href'</span>).indexOf(<span class="string">"https://"</span>)&gt;=<span class="number">0</span>)&#123;</span><br><span class="line">              <span class="keyword">var</span> arr = newA.attr(<span class="string">'href'</span>).split(<span class="string">'/'</span>)</span><br><span class="line">              <span class="keyword">var</span> newTxt = <span class="string">''</span></span><br><span class="line">              <span class="keyword">for</span>(<span class="keyword">var</span> i=<span class="number">3</span>; i&lt;arr.length;i++)&#123;</span><br><span class="line">                  newTxt +=<span class="string">'/'</span>+arr[i]</span><br><span class="line">              &#125;</span><br><span class="line">              newA.attr(<span class="string">'href'</span>,newTxt)</span><br><span class="line">          &#125;</span><br><span class="line"></span><br><span class="line">      &#125;)</span><br><span class="line">      content = toTxt(aE.html());</span><br><span class="line">      <span class="comment">//alert(content);</span></span><br><span class="line">      $(<span class="string">'#'</span>+QueryStringByName(<span class="string">'id'</span>), parent.document).html(content)</span><br><span class="line">  &#125;);</span><br><span class="line"></span><br><span class="line">  <span class="comment">//获取search参数</span></span><br><span class="line">  <span class="function"><span class="keyword">function</span> <span class="title">QueryStringByName</span>(<span class="params">name</span>)</span>&#123;</span><br><span class="line">      <span class="keyword">var</span> result=<span class="built_in">window</span>.location.search.match(<span class="keyword">new</span> <span class="built_in">RegExp</span>(<span class="string">"[\?\&amp;]"</span> + name + <span class="string">"=([^\&amp;]+)"</span>, <span class="string">"i"</span>));</span><br><span class="line">      <span class="keyword">if</span>(result==<span class="literal">null</span> || result.length&lt;<span class="number">0</span>)&#123;</span><br><span class="line">          <span class="keyword">return</span> <span class="string">""</span>;</span><br><span class="line">      &#125;</span><br><span class="line">      <span class="keyword">return</span> result[<span class="number">1</span>];</span><br><span class="line">  &#125;</span><br></pre></td></tr></table></figure>

<ol>
<li>在初始化的时候，跑去父窗口拿到数据的文本内容，做了一点点的延时加载。</li>
<li>使用<code>blur</code> 事件做 <code>textarea</code> 和 富文本编辑器的双向同步</li>
<li>同样需要处理内网地址暴露的问题，需要截取内网地址</li>
<li>对于特殊标签转义</li>
</ol>
<h3 id="总结：-1"><a href="#总结：-1" class="headerlink" title="总结："></a>总结：</h3><ol>
<li>富文本暂存区域，最好选隐藏域的 <code>textarea</code>，使用value 值会出现双引号截取的问题 </li>
<li>小心转义带来的各种问题，一定要记得何时数据会被转义，同时什么阶段的数据内容是什么形式</li>
<li>关注富文本编辑器本身干的一些”<code>杂活</code>“</li>
</ol>
<h2 id="处理百度编辑器粘贴在IE失效的问题（目前未找到解决方案）"><a href="#处理百度编辑器粘贴在IE失效的问题（目前未找到解决方案）" class="headerlink" title="处理百度编辑器粘贴在IE失效的问题（目前未找到解决方案）"></a>处理百度编辑器粘贴在IE失效的问题（目前未找到解决方案）</h2><h3 id="问题复现：-1"><a href="#问题复现：-1" class="headerlink" title="问题复现："></a>问题复现：</h3><p>这也是我要说的重点问题，目前我依然没有找到解决办法，下面的内容都是我的个人尝试，希望找到有过处理经验的人或者有其他方式的办法，有偿感谢！！</p>
<p>第一个问题：在IE当中，使用<code>ctrl + V</code> 是没有任何反应和效果的，而在谷歌的浏览器下面，</p>
<p>第二个问题：在IE中, 复制粘贴word内容无法粘贴图片</p>
<h3 id="无法解决的办法："><a href="#无法解决的办法：" class="headerlink" title="无法解决的办法："></a>无法解决的办法：</h3><p><span class="exturl" data-url="aHR0cHM6Ly93d3cuY25ibG9ncy5jb20vc29uZ3N1L3AvMTE5MTU0NzAuaHRtbA==" title="https://www.cnblogs.com/songsu/p/11915470.html">https://www.cnblogs.com/songsu/p/11915470.html<i class="fa fa-external-link"></i></span> </p>
<p>遇事不决找谷歌，谷歌出了一篇这种文章，试下</p>
<p>大概在<code>ueditor.all.js</code>文件的23881行左右</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br></pre></td><td class="code"><pre><span class="line">bindEvents:&#123;</span><br><span class="line">            <span class="comment">//插入粘贴板的图片，拖放插入图片</span></span><br><span class="line">            <span class="string">'ready'</span>:<span class="function"><span class="keyword">function</span>(<span class="params">e</span>)</span>&#123;</span><br><span class="line">                <span class="keyword">var</span> me = <span class="keyword">this</span>;</span><br><span class="line">                <span class="keyword">if</span>(<span class="built_in">window</span>.FormData &amp;&amp; <span class="built_in">window</span>.FileReader) &#123;</span><br><span class="line">                    domUtils.on(me.body, <span class="string">'paste drop'</span>, <span class="function"><span class="keyword">function</span>(<span class="params">e</span>)</span>&#123;</span><br><span class="line">                        <span class="comment">//判断剪贴板的内容是否包含文本</span></span><br><span class="line">                        <span class="comment">//首先解释一下为什么要判断文本是不是为空</span></span><br><span class="line">                        <span class="comment">//在ctrl+c word中的文字或者图片之后会返回1种(image/png)或者4种type(text/plain,text/html,text/rtf,image/png)类型的对象</span></span><br><span class="line">                        <span class="comment">//为了兼容4种格式的情况，做了如下的判断</span></span><br><span class="line">                        <span class="comment">//如下代码：e.originalEvent.clipboardData.items获得剪贴板的内容</span></span><br><span class="line">                        <span class="comment">//当粘贴了文本之后text是不为空的，同时也会返回当前文本的图片类型</span></span><br><span class="line">                        <span class="comment">//如果有文字的话不做任何的处理，如果只粘贴图片的话文本一定是空的，包括复制的桌面图片或者截图的图片</span></span><br><span class="line">                        <span class="comment">// var text = e.originalEvent.clipboardData.getData("text");</span></span><br><span class="line">                        <span class="comment">// if(text == "")&#123;</span></span><br><span class="line">                        <span class="comment">//     var items=e.originalEvent.clipboardData.items;</span></span><br><span class="line">                        <span class="comment">//     for (var i = 0, len = items.length; i &lt; len; i++) &#123;</span></span><br><span class="line">                        <span class="comment">//         var item = items[i];</span></span><br><span class="line">                        <span class="comment">//         if ( item.kind == 'file' &amp;&amp; item.type.indexOf('image/') !== -1 ) &#123;</span></span><br><span class="line">                        <span class="comment">//             var blob = item.getAsFile();</span></span><br><span class="line">                        <span class="comment">//             getBase64(blob, function( base64 ) &#123;</span></span><br><span class="line">                        <span class="comment">//                 //sendAndInsertImage(base64,me); 上传到服务器</span></span><br><span class="line">                        <span class="comment">//                 setBase64Image(base64,me);</span></span><br><span class="line">                        <span class="comment">//             &#125;);</span></span><br><span class="line">                        <span class="comment">//             //阻止默认事件, 避免重复添加;</span></span><br><span class="line">                        <span class="comment">//             e.originalEvent.preventDefault();</span></span><br><span class="line">                        <span class="comment">//         &#125;;</span></span><br><span class="line">                        <span class="comment">//     &#125;</span></span><br><span class="line">                        <span class="comment">// &#125;</span></span><br><span class="line"></span><br><span class="line">                        <span class="comment">//TODO 粘贴图片的根本问题点 20201010</span></span><br><span class="line">                        <span class="keyword">var</span> hasImg = <span class="literal">false</span>,</span><br><span class="line">                            items;</span><br><span class="line">                        <span class="comment">//获取粘贴板文件列表或者拖放文件列表</span></span><br><span class="line">                        items = e.type == <span class="string">'paste'</span> ? getPasteImage(e):getDropImage(e);</span><br><span class="line">                        <span class="keyword">if</span>(items)&#123;</span><br><span class="line">                            <span class="keyword">var</span> len = items.length,</span><br><span class="line">                                file;</span><br><span class="line">                            <span class="keyword">while</span> (len--)&#123;</span><br><span class="line">                                file = items[len];</span><br><span class="line">                                <span class="keyword">if</span>(file.getAsFile) file = file.getAsFile();</span><br><span class="line">                                <span class="keyword">if</span>(file &amp;&amp; file.size &gt; <span class="number">0</span>) &#123;</span><br><span class="line">                                    sendAndInsertFile(file, me);</span><br><span class="line">                                    hasImg = <span class="literal">true</span>;</span><br><span class="line">                                &#125;</span><br><span class="line">                            &#125;</span><br><span class="line">                            hasImg &amp;&amp; e.preventDefault();</span><br><span class="line">                        &#125;</span><br><span class="line"></span><br><span class="line">                    &#125;);</span><br><span class="line">                    <span class="comment">//取消拖放图片时出现的文字光标位置提示</span></span><br><span class="line">                    domUtils.on(me.body, <span class="string">'dragover'</span>, <span class="function"><span class="keyword">function</span> (<span class="params">e</span>) </span>&#123;</span><br><span class="line">                        <span class="keyword">if</span>(e.dataTransfer.types[<span class="number">0</span>] == <span class="string">'Files'</span>) &#123;</span><br><span class="line">                            e.preventDefault();</span><br><span class="line">                        &#125;</span><br><span class="line">                    &#125;);</span><br><span class="line"></span><br><span class="line">                    <span class="comment">//设置loading的样式</span></span><br><span class="line">                    utils.cssRule(<span class="string">'loading'</span>,</span><br><span class="line">                        <span class="string">'.loadingclass&#123;display:inline-block;cursor:default;background: url(\''</span></span><br><span class="line">                            + <span class="keyword">this</span>.options.themePath</span><br><span class="line">                            + <span class="keyword">this</span>.options.theme +<span class="string">'/images/loading.gif\') no-repeat center center transparent;border:1px solid #cccccc;margin-left:1px;height: 22px;width: 22px;&#125;\n'</span> +</span><br><span class="line">                            <span class="string">'.loaderrorclass&#123;display:inline-block;cursor:default;background: url(\''</span></span><br><span class="line">                            + <span class="keyword">this</span>.options.themePath</span><br><span class="line">                            + <span class="keyword">this</span>.options.theme +<span class="string">'/images/loaderror.png\') no-repeat center center transparent;border:1px solid #cccccc;margin-right:1px;height: 22px;width: 22px;'</span> +</span><br><span class="line">                            <span class="string">'&#125;'</span>,</span><br><span class="line">                        <span class="keyword">this</span>.document);</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br></pre></td></tr></table></figure>

<p>针对内容进行的处理操作</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">getPasteImage</span>(<span class="params">e</span>)</span>&#123;</span><br><span class="line">    </span><br><span class="line">       <span class="keyword">return</span> e.clipboardData &amp;&amp; e.clipboardData.items &amp;&amp; e.clipboardData.items.length == <span class="number">1</span> &amp;&amp; <span class="regexp">/^image\//</span>.test(e.clipboardData.items[<span class="number">0</span>].type) ? e.clipboardData.items:<span class="literal">null</span>;</span><br><span class="line">   &#125;</span><br><span class="line">   <span class="function"><span class="keyword">function</span> <span class="title">getDropImage</span>(<span class="params">e</span>)</span>&#123;</span><br><span class="line">       <span class="keyword">return</span>  e.dataTransfer &amp;&amp; e.dataTransfer.files ? e.dataTransfer.files:<span class="literal">null</span>;</span><br><span class="line">   &#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">   <span class="comment">//TODO 执行插入图片的操作 20201010</span></span><br><span class="line">   <span class="function"><span class="keyword">function</span> <span class="title">setBase64Image</span>(<span class="params">base64, editor</span>) </span>&#123;</span><br><span class="line">       editor.execCommand(<span class="string">'insertimage'</span>, &#123;</span><br><span class="line">           src: base64,</span><br><span class="line">           _src: base64</span><br><span class="line">       &#125;);</span><br><span class="line">   &#125;</span><br><span class="line"></span><br><span class="line">   <span class="comment">//TODO 获得base64 20201010</span></span><br><span class="line">   <span class="function"><span class="keyword">function</span> <span class="title">getBase64</span>(<span class="params">blob, callback</span>) </span>&#123;</span><br><span class="line">       <span class="keyword">var</span> a = <span class="keyword">new</span> FileReader();</span><br><span class="line">       a.onload = <span class="function"><span class="keyword">function</span>(<span class="params">e</span>) </span>&#123;</span><br><span class="line">           callback(e.target.result);</span><br><span class="line">       &#125;;</span><br><span class="line">       a.readAsDataURL(blob);</span><br><span class="line">   &#125;;</span><br></pre></td></tr></table></figure>

<p>博客的方式是读取二进制流为Blob,然后调用原始的上传接口进行兼容，然而，我在直接套用之后，连谷歌的粘贴也失效了<strong>（坑爹！）</strong></p>
<p>不用怀疑，肯定是：<code>getPasteImage()</code>中没有拿到想要的结果，所以我直接<code>alert</code>打印想要的内容，看下什么内容</p>
<p>加入代码<code>console.log(e.clipboardData)</code>看下IE什么效果（注意要使用高版本IE）</p>
<blockquote>
<p> 记得在测试之前，在粘贴板粘贴带图片内容的word内容，或者截个图粘贴到IE的富文本编辑框</p>
</blockquote>
<p><img src="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20201011132122.png" alt=""></p>
<p>不出所料，没有内容，我们直接打印 e 事件对象，看看有没有想要的内容</p>
<p><img src="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20201011132536.png" alt=""></p>
<p>错了，使用console：</p>
<p><img src="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20201011133204.png" alt=""></p>
<p>说实话，看不懂，凭感觉这里的<code>dataTransfer</code>没有内容，基本上是找不到如何获取粘贴板数据的点</p>
<p>所以个人判断是IE浏览器本身就对这种粘贴操作没有进行兼容或者处理（万恶的IE浏览器）</p>
<p>至此，我知道自己的能力不足，无法解决这个问题，所以跑去问前端了，然后前端百度一圈下来，和我说：”要不换个编辑器？”</p>
<p>我没有死心，继续搜索</p>
<h3 id="其他方式："><a href="#其他方式：" class="headerlink" title="其他方式："></a>其他方式：</h3><p>其实有其他的组织或者公司已经对于这种word的上传问题进行了解决</p>
<p><span class="exturl" data-url="aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L215Zm15Zm15Zm15Zi9hcnRpY2xlL2RldGFpbHMvMTgzOTkzMjk=" title="https://blog.csdn.net/myfmyfmyfmyf/article/details/18399329">ueditor文本编辑器支持ctrl+v图片文字样式<i class="fa fa-external-link"></i></span></p>
<p>总结：</p>
<ol>
<li>思路不错，但是基本属于闭门造车，并且还要安装一个exe的Active控件，无法解决问题</li>
<li>自己重写一个Active控件兼容处理</li>
</ol>
<p><span class="exturl" data-url="aHR0cDovL2Jsb2cubmNtZW0uY29tL3dvcmRwcmVzcy8yMDE5LzA4LzA3LyVFNSVBRiU4QyVFNiU5NiU4NyVFNiU5QyVBQyVFNyVCQyU5NiVFOCVCRSU5MSVFNSU5OSVBOCVFNyVCMiU5OCVFOCVCNCVCNHdvcmQlRTUlODYlODUlRTUlQUUlQjkv" title="http://blog.ncmem.com/wordpress/2019/08/07/%E5%AF%8C%E6%96%87%E6%9C%AC%E7%BC%96%E8%BE%91%E5%99%A8%E7%B2%98%E8%B4%B4word%E5%86%85%E5%AE%B9/">富文本编辑器粘贴word内容<i class="fa fa-external-link"></i></span></p>
<p>总结：</p>
<ol>
<li>其他公司二次开发，商用版本</li>
<li>个人版本要300多一年，比较麻烦</li>
<li>也是基于word的上传开发了插件，并且需要安装word上传的控件</li>
<li>感兴趣可以下载看下，localhost 和 “127.0.0.1” 可以正常上传和使用</li>
</ol>
<p><span class="exturl" data-url="aHR0cHM6Ly93d3cuY25ibG9ncy5jb20veWFuZ3poaS9wLzM1NzY1MjcuaHRtbA==" title="https://www.cnblogs.com/yangzhi/p/3576527.html">UEditor单独图片上传组件！适用IE,Chrome,firefox.<i class="fa fa-external-link"></i></span></p>
<p>总结：</p>
<ol>
<li>不是一码事，针对上传操作做了一些兼容和优化而已，无法解决粘贴的问题</li>
</ol>
<p>官方Github:<br>问题描述：从word中复制的图片粘贴到UEditor中以后不能正常显示，work图片转存的按钮也不可用。</p>
<p>解决方案：参看 <span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL2ZleC10ZWFtL3VlZGl0b3IvaXNzdWVzLzI4ODM=" title="https://github.com/fex-team/ueditor/issues/2883">ISSUE<i class="fa fa-external-link"></i></span></p>
<p>总结：</p>
<ol>
<li>虽然官方的ISSUE 有人提过了，但是我访问404 啊。。。。</li>
<li>现在已经邮箱打扰，不知道给不给我这个菜鸟回复。。。。</li>
</ol>
<p>经过上面的尝试之后，发现还是没有特别好的解决方式，于是反馈给上级，不让问题留在自己手里。。。。。</p>
<p>连官方那边都找不到办法，有点万念俱灰，于是把问题往上抛了，八成需要换编辑器，又有的忙了。。。。</p>
<h2 id="分享："><a href="#分享：" class="headerlink" title="分享："></a>分享：</h2><p>说了这么多，其实我最想说的是，解决问题建议各位一定要留下文档记录，哪怕是如何解决的也好。</p>
<p>我是一个后端的开发人员，但是却被安排到前端去处理前端的兼容性问题，其实当时顶着非常大的压力的，客户催得紧，经理也天天问我进度，辛好公司有一位干过全栈的大神在，我的许多奇葩的样式错乱和按钮点击问题都是找他帮忙解决的，我对IE的各种奇怪现象其实挺恶心的，最后还是拖累同事陪我加班到十点解决上面的暴露内网的问题。在解决之后，我说了这么一句话：“我这辈子都不想碰到IE了”，但是那位全栈的同事却和我说：“怕什么，我连IE6的兼容性都搞过，不是照样搞好，这些问题解决之后，这就是属于你的经验，你不断积累经验，才能比别人更多优势”，这对我今年的工作态度产生了很多的工作影响，我不在思考为了工作而工作，而是思考为了自己而工作，希望我的话对大家有帮助。</p>
<p><img src="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20201011125214.png" alt=""></p>
<h1 id="最后总结："><a href="#最后总结：" class="headerlink" title="最后总结："></a>最后总结：</h1><p>就以我这个老掉牙的系统来说，目前百度的编辑器兼容和支持是最好的，实在不想再换别的浏览器，或者说换之前再挣扎一下，所以写下。</p>
<p>欢迎各位前端大神指教，帮助一下我这个后端临时抽来解决前端问题的人QAQ</p>
<p>如果有好的解决方式，欢迎拍砖</p>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/kity@2.0.4/dist/kity.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/kityminder-core@1.4.50/dist/kityminder.core.min.js"></script><script defer="true" type="text/javascript" src="https://cdn.jsdelivr.net/npm/hexo-simple-mindmap@0.2.0/dist/mindmap.min.js"></script><link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/hexo-simple-mindmap@0.2.0/dist/mindmap.min.css">
    </div>

    
    
    
        

<div>
<ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者： </strong>lazytime
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="https://whitestore.top/2020/10/11/note32/" title="百度编辑器的那些坑">https://whitestore.top/2020/10/11/note32/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <span class="exturl" data-url="aHR0cHM6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL2xpY2Vuc2VzL2J5LW5jLzQuMC96aC1DTg=="><i class="fa fa-fw fa-creative-commons"></i>BY-NC</span> 许可协议。转载请注明出处！
  </li>
</ul>
</div>


      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/%E5%89%8D%E7%AB%AF/" rel="tag"># 前端</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2020/10/07/note30/" rel="prev" title="拥有一台surface pro3 是怎样的体验">
      <i class="fa fa-chevron-left"></i> 拥有一台surface pro3 是怎样的体验
    </a></div>
      <div class="post-nav-item">
    <a href="/2020/10/11/note31/" rel="next" title="一篇帖子解决window.open中使用jquery操作父元素的问题">
      一篇帖子解决window.open中使用jquery操作父元素的问题 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          
    <div class="comments" id="valine-comments"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#百度编辑器的那些坑："><span class="nav-number">1.</span> <span class="nav-text">百度编辑器的那些坑：</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#前言："><span class="nav-number">1.1.</span> <span class="nav-text">前言：</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#问题："><span class="nav-number">1.2.</span> <span class="nav-text">问题：</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#百度编辑器粘贴图片的时候，会出现暴露内网IP的隐患-IE问题"><span class="nav-number">1.3.</span> <span class="nav-text">百度编辑器粘贴图片的时候，会出现暴露内网IP的隐患  - IE问题</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#问题复现"><span class="nav-number">1.3.1.</span> <span class="nav-text">问题复现</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#解决办法："><span class="nav-number">1.3.2.</span> <span class="nav-text">解决办法：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#障眼法："><span class="nav-number">1.3.3.</span> <span class="nav-text">障眼法：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#总结："><span class="nav-number">1.3.4.</span> <span class="nav-text">总结：</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#特殊符号传输后台的转义问题，以及读取数据的问题"><span class="nav-number">1.4.</span> <span class="nav-text">特殊符号传输后台的转义问题，以及读取数据的问题</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#amp"><span class="nav-number">1.5.</span> <span class="nav-text">&amp;</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#针对-iframe这种嵌套框架，在保存的之后，拿不到编辑器内容的兼容处理方式"><span class="nav-number">1.6.</span> <span class="nav-text">针对 iframe这种嵌套框架，在保存的之后，拿不到编辑器内容的兼容处理方式</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#问题复现："><span class="nav-number">1.6.1.</span> <span class="nav-text">问题复现：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#解决办法：-1"><span class="nav-number">1.6.2.</span> <span class="nav-text">解决办法：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#总结：-1"><span class="nav-number">1.6.3.</span> <span class="nav-text">总结：</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#处理百度编辑器粘贴在IE失效的问题（目前未找到解决方案）"><span class="nav-number">1.7.</span> <span class="nav-text">处理百度编辑器粘贴在IE失效的问题（目前未找到解决方案）</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#问题复现：-1"><span class="nav-number">1.7.1.</span> <span class="nav-text">问题复现：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#无法解决的办法："><span class="nav-number">1.7.2.</span> <span class="nav-text">无法解决的办法：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#其他方式："><span class="nav-number">1.7.3.</span> <span class="nav-text">其他方式：</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#分享："><span class="nav-number">1.8.</span> <span class="nav-text">分享：</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#最后总结："><span class="nav-number">2.</span> <span class="nav-text">最后总结：</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">阿东</p>
  <div class="site-description" itemprop="description">随遇而安</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">239</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">36</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">37</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL2xhenlUaW1lcw==" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;lazyTimes"><i class="fa fa-fw fa-github"></i>GitHub</span>
      </span>
      <span class="links-of-author-item">
        <span class="exturl" data-url="bWFpbHRvOjEwOTc0ODM1MDhAcXEuY29t" title="E-Mail → mailto:1097483508@qq.com"><i class="fa fa-fw fa-envelope"></i>E-Mail</span>
      </span>
  </div>


  <div class="links-of-blogroll motion-element">
    <div class="links-of-blogroll-title">
      <i class="fa fa-fw fa-link"></i>
      友情链接
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <span class="exturl" data-url="aHR0cHM6Ly93d3cuNTJwb2ppZS5jbi9ob21lLnBocD9tb2Q9c3BhY2UmdWlkPTE0OTc3MTgmZG89dGhyZWFkJnZpZXc9bWUmZnJvbT1zcGFjZQ==" title="https:&#x2F;&#x2F;www.52pojie.cn&#x2F;home.php?mod&#x3D;space&amp;uid&#x3D;1497718&amp;do&#x3D;thread&amp;view&#x3D;me&amp;from&#x3D;space">吾爱破解</span>
        </li>
        <li class="links-of-blogroll-item">
          <span class="exturl" data-url="aHR0cHM6Ly9qdWVqaW4uaW0vdXNlci8yOTk5MTIzNDUyNjI2MzY2" title="https:&#x2F;&#x2F;juejin.im&#x2F;user&#x2F;2999123452626366">掘金</span>
        </li>
        <li class="links-of-blogroll-item">
          <span class="exturl" data-url="aHR0cHM6Ly9zZWdtZW50ZmF1bHQuY29tL3UvbGF6eXRpbWVz" title="https:&#x2F;&#x2F;segmentfault.com&#x2F;u&#x2F;lazytimes">思否</span>
        </li>
    </ul>
  </div>

      </div>

      <div class="wechat_OA">
        <span>欢迎关注我的公众号</span>
        <br>
          <!-- 这里添加你的二维码图片 -->
        <img src ="https://adong-picture.oss-cn-shenzhen.aliyuncs.com/adong/wechat_channel.jpg">
      </div>
        <div class="back-to-top motion-element">
          <i class="fa fa-arrow-up"></i>
          <span>0%</span>
        </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2023</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">阿东</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-area-chart"></i>
    </span>
      <span class="post-meta-item-text">站点总字数：</span>
    <span title="站点总字数">2m</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span class="post-meta-item-text">站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">29:50</span>
</div>
  <div class="powered-by">由 <span class="exturl theme-link" data-url="aHR0cHM6Ly9oZXhvLmlv">Hexo</span> & <span class="exturl theme-link" data-url="aHR0cHM6Ly90aGVtZS1uZXh0Lm9yZw==">NexT.Gemini</span> 强力驱动
  </div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
  <script src="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>




  




  
<script src="/js/local-search.js"></script>













  

  


<script>
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
    var GUEST = ['nick', 'mail', 'link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item => {
      return GUEST.includes(item);
    });
    new Valine({
      el         : '#valine-comments',
      verify     : false,
      notify     : true,
      appId      : 'qMUpEEvBgXaMDD1b0ftgi9xr-gzGzoHsz',
      appKey     : 'UCdfT4Rfih6MO6y8DI4fstf6',
      placeholder: "Just go go",
      avatar     : 'mm',
      meta       : guest,
      pageSize   : '10' || 10,
      visitor    : false,
      lang       : 'zh-CN' || 'zh-cn',
      path       : location.pathname,
      recordIP   : false,
      serverURLs : ''
    });
  }, window.Valine);
});
</script>

</body>
</html>
